package bairui.international.model.domain.jpa;

import com.lianjing.sh.model.uml.model.data.TBSuper_BaseIDAndTimeAndOrderValue;

/**
 *
 * (产品分类)TB_ProductCategory
 *
 * @说明
 * <pre>

 * </pre>
 *
 * @see Help_TB_ProductCategory#inheritance() 继承体系信息
 *
 */
@org.hibernate.annotations.DynamicInsert
@org.hibernate.annotations.DynamicUpdate

@javax.persistence.Entity(name="t_productCategory")
@com.lianjing.sh.processing.info.annotation.GenerateInfoModel
@SuppressWarnings("serial")
@com.lianjing.sh.model.common.annotation.Comment("产品分类")
@com.lianjing.sh.processing.info.annotation.InfoComment("产品分类")
public class TB_ProductCategory
 extends TBSuper_BaseIDAndTimeAndOrderValue
 implements 
	com.lianjing.sh.model.common.stardard.TableModel<Long>,
	java.io.Serializable

{

	
	
	/**
	 * 必须属性赋值接口
	 */
	public static interface MustProperties{
		/** 名称 */
		public String getName();
		/** 级别 */
		public Integer getLevel();
		/** 代码 */
		public String getNumber();
	}
	
	/**
	 * 为必须属性赋值
	 */
	public TB_ProductCategory properties(MustProperties properties) {
		this.setName(properties.getName());
		this.setLevel(properties.getLevel());
		this.setNumber(properties.getNumber());
		return this;
	}
	
	/**
	 *	必须属性构造函数
	 */
	public TB_ProductCategory(MustProperties properties) {
		this.properties(properties);
	}
	
	
	/**
	 * 可选单属性赋值接口
	 */
	public static interface OptionalSingleProperties{
		/** 父 */
		public bairui.international.model.domain.jpa.TB_ProductCategory getParent();
		/** 根 */
		public bairui.international.model.domain.jpa.TB_ProductCategory getRoot();
	}
	
	/**
	 * 为可选单属性赋值
	 */
	public TB_ProductCategory properties(OptionalSingleProperties properties) {
		this.setParent(properties.getParent());
		this.setRoot(properties.getRoot());
		return this;
	}
	
	
	
	public TB_ProductCategory(MustProperties must, OptionalSingleProperties optionalSingle) {
		this.properties(must);
		this.properties(optionalSingle);
	}
	
	/**
	 * 仅当前必须属性赋值接口
	 */
	public static interface CurrentMustProperties{
		/** 名称 */
		public String getName();
		/** 级别 */
		public Integer getLevel();
		/** 代码 */
		public String getNumber();
	}
	
	/**
	 * 为仅当前必须属性赋值
	 */
	public TB_ProductCategory properties(CurrentMustProperties properties) {
		this.setName(properties.getName());
		this.setLevel(properties.getLevel());
		this.setNumber(properties.getNumber());
		return this;
	}
	
	/**
	 * 仅当前可选单属性赋值接口
	 */
	public static interface CurrentOptionalSingleProperties{
		/** 父 */
		public bairui.international.model.domain.jpa.TB_ProductCategory getParent();
		/** 根 */
		public bairui.international.model.domain.jpa.TB_ProductCategory getRoot();
	}
	
	/**
	 * 为仅当前可选单属性赋值
	 */
	public TB_ProductCategory properties(CurrentOptionalSingleProperties properties) {
		this.setParent(properties.getParent());
		this.setRoot(properties.getRoot());
		return this;
	}
	
	public TB_ProductCategory(
		@lombok.NonNull com.lianjing.sh.model.uml.model.data.TBSuper_BaseIDAndTimeAndOrderValue bean,
		CurrentMustProperties mustProperties,
		CurrentOptionalSingleProperties optionalProperties
	) {
		this(bean);
		this.properties(mustProperties);
		this.properties(optionalProperties);
	}
	
	public TB_ProductCategory(
		@lombok.NonNull com.lianjing.sh.model.uml.model.data.TBSuper_BaseIDAndTimeAndOrderValue bean
	) {
		update(bean);
	}
	
	public TB_ProductCategory update(com.lianjing.sh.model.uml.model.data.TBSuper_BaseIDAndTimeAndOrderValue bean){
		this.setId(bean.getId());
		this.setCreateTime(bean.getCreateTime());
		this.setModifyTime(bean.getModifyTime());
		this.setOrderValue(bean.getOrderValue());
		return this;
	}
	
	
	/**
	 * 更新属性内部类
	 */
	public abstract class UpdateProperties {
	
		public UpdateProperties() throws Exception {
			Integer orderValue = getOrderValue(TB_ProductCategory.this);
			if(isOverride_getOrderValue){
				TB_ProductCategory.this.setOrderValue(orderValue);
			}
	
			String name = getName(TB_ProductCategory.this);
			if(isOverride_getName){
				TB_ProductCategory.this.setName(name);
			}
	
			java.util.List<bairui.international.model.domain.jpa.TB_Product> products = getProducts(TB_ProductCategory.this);
			if(isOverride_getProducts){
				TB_ProductCategory.this.setProducts(products);
			}
	
			Integer level = getLevel(TB_ProductCategory.this);
			if(isOverride_getLevel){
				TB_ProductCategory.this.setLevel(level);
			}
	
			String number = getNumber(TB_ProductCategory.this);
			if(isOverride_getNumber){
				TB_ProductCategory.this.setNumber(number);
			}
	
			bairui.international.model.domain.jpa.TB_ProductCategory parent = getParent(TB_ProductCategory.this);
			if(isOverride_getParent){
				TB_ProductCategory.this.setParent(parent);
			}
	
			java.util.List<bairui.international.model.domain.jpa.TB_ProductCategory> children = getChildren(TB_ProductCategory.this);
			if(isOverride_getChildren){
				TB_ProductCategory.this.setChildren(children);
			}
	
			java.util.List<bairui.international.model.domain.jpa.TB_Product> rootCategoryProdcuts = getRootCategoryProdcuts(TB_ProductCategory.this);
			if(isOverride_getRootCategoryProdcuts){
				TB_ProductCategory.this.setRootCategoryProdcuts(rootCategoryProdcuts);
			}
	
			java.util.List<bairui.international.model.domain.jpa.TB_ProductCategoryProperty> productCategoryProperties = getProductCategoryProperties(TB_ProductCategory.this);
			if(isOverride_getProductCategoryProperties){
				TB_ProductCategory.this.setProductCategoryProperties(productCategoryProperties);
			}
	
			bairui.international.model.domain.jpa.TB_ProductCategory root = getRoot(TB_ProductCategory.this);
			if(isOverride_getRoot){
				TB_ProductCategory.this.setRoot(root);
			}
	
			java.util.List<bairui.international.model.domain.jpa.TB_ProductCategory> progeny = getProgeny(TB_ProductCategory.this);
			if(isOverride_getProgeny){
				TB_ProductCategory.this.setProgeny(progeny);
			}
		}
	
		public TB_ProductCategory up(){
			return TB_ProductCategory.this;
		}
	
		/** 排序值 */
		private boolean isOverride_getOrderValue = true;
		public Integer getOrderValue(TB_ProductCategory it) throws Exception { 
			isOverride_getOrderValue = false; 
			return null;
		}
		/** 名称 */
		private boolean isOverride_getName = true;
		public String getName(TB_ProductCategory it) throws Exception { 
			isOverride_getName = false; 
			return null;
		}
		/** 产品 */
		private boolean isOverride_getProducts = true;
		public java.util.List<bairui.international.model.domain.jpa.TB_Product> getProducts(TB_ProductCategory it) throws Exception { 
			isOverride_getProducts = false; 
			return null;
		}
		/** 级别 */
		private boolean isOverride_getLevel = true;
		public Integer getLevel(TB_ProductCategory it) throws Exception { 
			isOverride_getLevel = false; 
			return null;
		}
		/** 代码 */
		private boolean isOverride_getNumber = true;
		public String getNumber(TB_ProductCategory it) throws Exception { 
			isOverride_getNumber = false; 
			return null;
		}
		/** 父 */
		private boolean isOverride_getParent = true;
		public bairui.international.model.domain.jpa.TB_ProductCategory getParent(TB_ProductCategory it) throws Exception { 
			isOverride_getParent = false; 
			return null;
		}
		/** 子 */
		private boolean isOverride_getChildren = true;
		public java.util.List<bairui.international.model.domain.jpa.TB_ProductCategory> getChildren(TB_ProductCategory it) throws Exception { 
			isOverride_getChildren = false; 
			return null;
		}
		/** 根分类下产品 */
		private boolean isOverride_getRootCategoryProdcuts = true;
		public java.util.List<bairui.international.model.domain.jpa.TB_Product> getRootCategoryProdcuts(TB_ProductCategory it) throws Exception { 
			isOverride_getRootCategoryProdcuts = false; 
			return null;
		}
		/** 产品分类属性 */
		private boolean isOverride_getProductCategoryProperties = true;
		public java.util.List<bairui.international.model.domain.jpa.TB_ProductCategoryProperty> getProductCategoryProperties(TB_ProductCategory it) throws Exception { 
			isOverride_getProductCategoryProperties = false; 
			return null;
		}
		/** 根 */
		private boolean isOverride_getRoot = true;
		public bairui.international.model.domain.jpa.TB_ProductCategory getRoot(TB_ProductCategory it) throws Exception { 
			isOverride_getRoot = false; 
			return null;
		}
		/** 后代 */
		private boolean isOverride_getProgeny = true;
		public java.util.List<bairui.international.model.domain.jpa.TB_ProductCategory> getProgeny(TB_ProductCategory it) throws Exception { 
			isOverride_getProgeny = false; 
			return null;
		}
	
	}
	
	
	/**
	 * 构造函数
	 */
	public TB_ProductCategory() {
	}
	
	public TB_ProductCategory(
		@lombok.NonNull Long id
	) {
		this.setId(id);
	}
	
	public TB_ProductCategory(
		@lombok.NonNull TB_ProductCategory bean
	) {
		this.setId(bean.getId());
		this.setCreateTime(bean.getCreateTime());
		this.setModifyTime(bean.getModifyTime());
		this.setOrderValue(bean.getOrderValue());
		this.setName(bean.getName());
		this.setProducts(bean.getProducts());
		this.setCreator(bean.getCreator());
		this.setLastModifier(bean.getLastModifier());
		this.setLevel(bean.getLevel());
		this.setNumber(bean.getNumber());
		this.setParent(bean.getParent());
		this.setChildren(bean.getChildren());
		this.setRootCategoryProdcuts(bean.getRootCategoryProdcuts());
		this.setProductCategoryProperties(bean.getProductCategoryProperties());
		this.setRoot(bean.getRoot());
		this.setProgeny(bean.getProgeny());
	}
	
	

	


	/**
	 * 属性
	 */
	@com.lianjing.sh.model.common.annotation.Comment("名称")
	@com.lianjing.sh.processing.info.annotation.InfoComment("名称")
	@javax.persistence.Column(name="name", nullable=false, length=100)
	private String name;

	@com.lianjing.sh.model.common.annotation.Comment("产品")
	@com.lianjing.sh.processing.info.annotation.InfoComment("产品")
	@com.querydsl.core.annotations.QueryInit("*.*.*")
	@javax.persistence.OneToMany(mappedBy="productCategory")
	private java.util.List<bairui.international.model.domain.jpa.TB_Product> products;

	@com.lianjing.sh.model.common.annotation.Comment("创建者")
	@com.lianjing.sh.processing.info.annotation.InfoComment("创建者")
	@com.querydsl.core.annotations.QueryInit("*.*.*")
	@javax.persistence.JoinColumn(name="creator_id", nullable=false)
	@javax.persistence.ManyToOne(optional=false)
	private bairui.international.model.domain.jpa.TB_Admin creator;

	@com.lianjing.sh.model.common.annotation.Comment("最后修改者")
	@com.lianjing.sh.processing.info.annotation.InfoComment("最后修改者")
	@com.querydsl.core.annotations.QueryInit("*.*.*")
	@javax.persistence.JoinColumn(name="lastModifier_id", nullable=false)
	@javax.persistence.ManyToOne(optional=false)
	private bairui.international.model.domain.jpa.TB_Admin lastModifier;

	@com.lianjing.sh.model.common.annotation.Comment("级别")
	@com.lianjing.sh.processing.info.annotation.InfoComment("级别")
	@javax.persistence.Column(name="level", nullable=false)
	private Integer level;

	@com.lianjing.sh.model.common.annotation.Comment("代码")
	@com.lianjing.sh.processing.info.annotation.InfoComment("代码")
	@javax.persistence.Column(name="number", nullable=false, length=100)
	private String number;

	@com.lianjing.sh.model.common.annotation.Comment("父")
	@com.lianjing.sh.processing.info.annotation.InfoComment("父")
	@com.querydsl.core.annotations.QueryInit("*.*.*")
	@javax.persistence.ManyToOne()
	private bairui.international.model.domain.jpa.TB_ProductCategory parent;

	@com.lianjing.sh.model.common.annotation.Comment("子")
	@com.lianjing.sh.processing.info.annotation.InfoComment("子")
	@com.querydsl.core.annotations.QueryInit("*.*.*")
	@javax.persistence.OneToMany(mappedBy="parent")
	private java.util.List<bairui.international.model.domain.jpa.TB_ProductCategory> children;

	@com.lianjing.sh.model.common.annotation.Comment("根分类下产品")
	@com.lianjing.sh.processing.info.annotation.InfoComment("根分类下产品")
	@com.querydsl.core.annotations.QueryInit("*.*.*")
	@javax.persistence.OneToMany(mappedBy="rootCategory")
	private java.util.List<bairui.international.model.domain.jpa.TB_Product> rootCategoryProdcuts;

	@com.lianjing.sh.model.common.annotation.Comment("产品分类属性")
	@com.lianjing.sh.processing.info.annotation.InfoComment("产品分类属性")
	@com.querydsl.core.annotations.QueryInit("*.*.*")
	@javax.persistence.OneToMany(mappedBy="productCategory")
	private java.util.List<bairui.international.model.domain.jpa.TB_ProductCategoryProperty> productCategoryProperties;

	@com.lianjing.sh.model.common.annotation.Comment("根")
	@com.lianjing.sh.processing.info.annotation.InfoComment("根")
	@com.querydsl.core.annotations.QueryInit("*.*.*")
	@javax.persistence.ManyToOne()
	private bairui.international.model.domain.jpa.TB_ProductCategory root;

	@com.lianjing.sh.model.common.annotation.Comment("后代")
	@com.lianjing.sh.processing.info.annotation.InfoComment("后代")
	@com.querydsl.core.annotations.QueryInit("*.*.*")
	@javax.persistence.OneToMany(mappedBy="root")
	private java.util.List<bairui.international.model.domain.jpa.TB_ProductCategory> progeny;

	/** get[名称] */
	public String getName() {
		return this.name;
	}

	/** get[产品] */
	public java.util.List<bairui.international.model.domain.jpa.TB_Product> getProducts() {
		return this.products;
	}

	/** get[创建者] */
	public bairui.international.model.domain.jpa.TB_Admin getCreator() {
		return this.creator;
	}

	/** get[最后修改者] */
	public bairui.international.model.domain.jpa.TB_Admin getLastModifier() {
		return this.lastModifier;
	}

	/** get[级别] */
	public Integer getLevel() {
		return this.level;
	}

	/** get[代码] */
	public String getNumber() {
		return this.number;
	}

	/** get[父] */
	public bairui.international.model.domain.jpa.TB_ProductCategory getParent() {
		return this.parent;
	}

	/** get[子] */
	public java.util.List<bairui.international.model.domain.jpa.TB_ProductCategory> getChildren() {
		return this.children;
	}

	/** get[根分类下产品] */
	public java.util.List<bairui.international.model.domain.jpa.TB_Product> getRootCategoryProdcuts() {
		return this.rootCategoryProdcuts;
	}

	/** get[产品分类属性] */
	public java.util.List<bairui.international.model.domain.jpa.TB_ProductCategoryProperty> getProductCategoryProperties() {
		return this.productCategoryProperties;
	}

	/** get[根] */
	public bairui.international.model.domain.jpa.TB_ProductCategory getRoot() {
		return this.root;
	}

	/** get[后代] */
	public java.util.List<bairui.international.model.domain.jpa.TB_ProductCategory> getProgeny() {
		return this.progeny;
	}

	/** set[名称] */
	public void setName(String name) {
		this.name = name;
	}

	/** set[产品] */
	public void setProducts(java.util.List<bairui.international.model.domain.jpa.TB_Product> products) {
		this.products = products;
	}

	/** set[创建者] */
	public void setCreator(bairui.international.model.domain.jpa.TB_Admin creator) {
		this.creator = creator;
	}

	/** set[最后修改者] */
	public void setLastModifier(bairui.international.model.domain.jpa.TB_Admin lastModifier) {
		this.lastModifier = lastModifier;
	}

	/** set[级别] */
	public void setLevel(Integer level) {
		this.level = level;
	}

	/** set[代码] */
	public void setNumber(String number) {
		this.number = number;
	}

	/** set[父] */
	public void setParent(bairui.international.model.domain.jpa.TB_ProductCategory parent) {
		this.parent = parent;
	}

	/** set[子] */
	public void setChildren(java.util.List<bairui.international.model.domain.jpa.TB_ProductCategory> children) {
		this.children = children;
	}

	/** set[根分类下产品] */
	public void setRootCategoryProdcuts(java.util.List<bairui.international.model.domain.jpa.TB_Product> rootCategoryProdcuts) {
		this.rootCategoryProdcuts = rootCategoryProdcuts;
	}

	/** set[产品分类属性] */
	public void setProductCategoryProperties(java.util.List<bairui.international.model.domain.jpa.TB_ProductCategoryProperty> productCategoryProperties) {
		this.productCategoryProperties = productCategoryProperties;
	}

	/** set[根] */
	public void setRoot(bairui.international.model.domain.jpa.TB_ProductCategory root) {
		this.root = root;
	}

	/** set[后代] */
	public void setProgeny(java.util.List<bairui.international.model.domain.jpa.TB_ProductCategory> progeny) {
		this.progeny = progeny;
	}




	public void assignParent(bairui.international.model.domain.jpa.TB_ProductCategory parent) {
		if(null != parent){
			parent.addChildren(this);
		}
		this.setParent(parent);
	}
	




	public void assignRoot(bairui.international.model.domain.jpa.TB_ProductCategory root) {
		if(null != root){
			root.addProgeny(this);
		}
		this.setRoot(root);
	}
	


	/** add[Products] */
	public TB_ProductCategory addProducts(bairui.international.model.domain.jpa.TB_Product ... products){
		if(this.products == null){
			this.products = new java.util.ArrayList<>();
		}
		for(bairui.international.model.domain.jpa.TB_Product bean : products){
			bean.setProductCategory(this);
			this.products.add(bean);
		}
		return this;
	}
	/** add[Children] */
	public TB_ProductCategory addChildren(bairui.international.model.domain.jpa.TB_ProductCategory ... children){
		if(this.children == null){
			this.children = new java.util.ArrayList<>();
		}
		for(bairui.international.model.domain.jpa.TB_ProductCategory bean : children){
			bean.setParent(this);
			this.children.add(bean);
		}
		return this;
	}
	/** add[RootCategoryProdcuts] */
	public TB_ProductCategory addRootCategoryProdcuts(bairui.international.model.domain.jpa.TB_Product ... rootCategoryProdcuts){
		if(this.rootCategoryProdcuts == null){
			this.rootCategoryProdcuts = new java.util.ArrayList<>();
		}
		for(bairui.international.model.domain.jpa.TB_Product bean : rootCategoryProdcuts){
			bean.setRootCategory(this);
			this.rootCategoryProdcuts.add(bean);
		}
		return this;
	}
	/** add[ProductCategoryProperties] */
	public TB_ProductCategory addProductCategoryProperties(bairui.international.model.domain.jpa.TB_ProductCategoryProperty ... productCategoryProperties){
		if(this.productCategoryProperties == null){
			this.productCategoryProperties = new java.util.ArrayList<>();
		}
		for(bairui.international.model.domain.jpa.TB_ProductCategoryProperty bean : productCategoryProperties){
			bean.setProductCategory(this);
			this.productCategoryProperties.add(bean);
		}
		return this;
	}
	/** add[Progeny] */
	public TB_ProductCategory addProgeny(bairui.international.model.domain.jpa.TB_ProductCategory ... progeny){
		if(this.progeny == null){
			this.progeny = new java.util.ArrayList<>();
		}
		for(bairui.international.model.domain.jpa.TB_ProductCategory bean : progeny){
			bean.setRoot(this);
			this.progeny.add(bean);
		}
		return this;
	}
	
	/** remove[Products] */
	public TB_ProductCategory removeProducts(bairui.international.model.domain.jpa.TB_Product ... products){
		if(this.products == null){
			return this;
		}
		for(bairui.international.model.domain.jpa.TB_Product bean : products){
			bean.setProductCategory(null);
			this.products.remove(bean);
		}
		return this;
	}
	/** remove[Children] */
	public TB_ProductCategory removeChildren(bairui.international.model.domain.jpa.TB_ProductCategory ... children){
		if(this.children == null){
			return this;
		}
		for(bairui.international.model.domain.jpa.TB_ProductCategory bean : children){
			bean.setParent(null);
			this.children.remove(bean);
		}
		return this;
	}
	/** remove[RootCategoryProdcuts] */
	public TB_ProductCategory removeRootCategoryProdcuts(bairui.international.model.domain.jpa.TB_Product ... rootCategoryProdcuts){
		if(this.rootCategoryProdcuts == null){
			return this;
		}
		for(bairui.international.model.domain.jpa.TB_Product bean : rootCategoryProdcuts){
			bean.setRootCategory(null);
			this.rootCategoryProdcuts.remove(bean);
		}
		return this;
	}
	/** remove[ProductCategoryProperties] */
	public TB_ProductCategory removeProductCategoryProperties(bairui.international.model.domain.jpa.TB_ProductCategoryProperty ... productCategoryProperties){
		if(this.productCategoryProperties == null){
			return this;
		}
		for(bairui.international.model.domain.jpa.TB_ProductCategoryProperty bean : productCategoryProperties){
			bean.setProductCategory(null);
			this.productCategoryProperties.remove(bean);
		}
		return this;
	}
	/** remove[Progeny] */
	public TB_ProductCategory removeProgeny(bairui.international.model.domain.jpa.TB_ProductCategory ... progeny){
		if(this.progeny == null){
			return this;
		}
		for(bairui.international.model.domain.jpa.TB_ProductCategory bean : progeny){
			bean.setRoot(null);
			this.progeny.remove(bean);
		}
		return this;
	}
	
	/**
	 * contains[Products]
	 *
	 * 全部输入都包含：返回 true
	 * 输入中有至少有一个不包含：返回 false
	 */
	public boolean containsProducts(bairui.international.model.domain.jpa.TB_Product ... products){
		if(this.products == null || products==null || products.length<=0){
			return false;
		}
		return this.products.containsAll(java.util.Arrays.asList(products));
	}
	/**
	 * contains[Children]
	 *
	 * 全部输入都包含：返回 true
	 * 输入中有至少有一个不包含：返回 false
	 */
	public boolean containsChildren(bairui.international.model.domain.jpa.TB_ProductCategory ... children){
		if(this.children == null || children==null || children.length<=0){
			return false;
		}
		return this.children.containsAll(java.util.Arrays.asList(children));
	}
	/**
	 * contains[RootCategoryProdcuts]
	 *
	 * 全部输入都包含：返回 true
	 * 输入中有至少有一个不包含：返回 false
	 */
	public boolean containsRootCategoryProdcuts(bairui.international.model.domain.jpa.TB_Product ... rootCategoryProdcuts){
		if(this.rootCategoryProdcuts == null || rootCategoryProdcuts==null || rootCategoryProdcuts.length<=0){
			return false;
		}
		return this.rootCategoryProdcuts.containsAll(java.util.Arrays.asList(rootCategoryProdcuts));
	}
	/**
	 * contains[ProductCategoryProperties]
	 *
	 * 全部输入都包含：返回 true
	 * 输入中有至少有一个不包含：返回 false
	 */
	public boolean containsProductCategoryProperties(bairui.international.model.domain.jpa.TB_ProductCategoryProperty ... productCategoryProperties){
		if(this.productCategoryProperties == null || productCategoryProperties==null || productCategoryProperties.length<=0){
			return false;
		}
		return this.productCategoryProperties.containsAll(java.util.Arrays.asList(productCategoryProperties));
	}
	/**
	 * contains[Progeny]
	 *
	 * 全部输入都包含：返回 true
	 * 输入中有至少有一个不包含：返回 false
	 */
	public boolean containsProgeny(bairui.international.model.domain.jpa.TB_ProductCategory ... progeny){
		if(this.progeny == null || progeny==null || progeny.length<=0){
			return false;
		}
		return this.progeny.containsAll(java.util.Arrays.asList(progeny));
	}
	

	/** take[创建者] */
	public bairui.international.model.domain.jpa.TB_Admin takeCreator(){
		if(null == this.creator){
			this.creator = new bairui.international.model.domain.jpa.TB_Admin();
		}
		return this.creator;
	}
	
	/** take[最后修改者] */
	public bairui.international.model.domain.jpa.TB_Admin takeLastModifier(){
		if(null == this.lastModifier){
			this.lastModifier = new bairui.international.model.domain.jpa.TB_Admin();
		}
		return this.lastModifier;
	}
	
	/** take[父] */
	public bairui.international.model.domain.jpa.TB_ProductCategory takeParent(){
		if(null == this.parent){
			this.parent = new bairui.international.model.domain.jpa.TB_ProductCategory();
		}
		return this.parent;
	}
	
	/** take[根] */
	public bairui.international.model.domain.jpa.TB_ProductCategory takeRoot(){
		if(null == this.root){
			this.root = new bairui.international.model.domain.jpa.TB_ProductCategory();
		}
		return this.root;
	}
	
	/** must[创建者] */
	public bairui.international.model.domain.jpa.TB_Admin mustCreator() {
		return this.creator;
	}
	
	/** must[最后修改者] */
	public bairui.international.model.domain.jpa.TB_Admin mustLastModifier() {
		return this.lastModifier;
	}
	
	/** optional[父] */
	public java.util.Optional<bairui.international.model.domain.jpa.TB_ProductCategory> optionalParent() {
		return java.util.Optional.ofNullable(this.parent);
	}
	
	/** optional[根] */
	public java.util.Optional<bairui.international.model.domain.jpa.TB_ProductCategory> optionalRoot() {
		return java.util.Optional.ofNullable(this.root);
	}
	

	/**
	 * 复写 hashCode
	 */
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		return prime * result + ((this.getId() == null) ? 0 : this.getId().hashCode());
	}
	
	/**
	 * 复写 equals
	 */
	@Override
	public boolean equals(Object obj) {
		if (this == obj){
			return true;
		}
		if (obj == null){
			return false;
		}
		if (getClass() != obj.getClass()){
			return false;
		}
		TB_ProductCategory other = (TB_ProductCategory) obj;
		if (this.getId() == null) {
			return false;
		} else if (!this.getId().equals(other.getId())){
			return false;
		}
		return true;
	}
	

	/**
	 * 用来覆盖toString()的输出
	 */
	@javax.persistence.Transient
	private String toString;
	
	public void setToString(String toString) {
		this.toString = toString;
	}
	
	/**
	 * 复写 toString
	 */
	@Override
	public String toString() {
		if(null != this.toString){
			return this.toString;
		}
		String name = this.getName();
		if(null != name){
			return String.valueOf(name);
		}
		return super.toString();
	}	

	@javax.persistence.PrePersist
	public void prePersist() {
		com.lianjing.sh.web.security.authority.login.LoginUserInfo userInfo = com.lianjing.sh.web.security.authority.login.Util_Login.getInfo();
		Object user = null == userInfo ? null : userInfo.getUser();
		this.setCreateTime(new java.util.Date());
		this.setModifyTime(new java.util.Date());
		this.setCreator((bairui.international.model.domain.jpa.TB_Admin)user);
		this.setLastModifier((bairui.international.model.domain.jpa.TB_Admin)user);
	}
	
	@javax.persistence.PreUpdate
	public void preUpdate() {
		com.lianjing.sh.web.security.authority.login.LoginUserInfo userInfo = com.lianjing.sh.web.security.authority.login.Util_Login.getInfo();
		Object user = null == userInfo ? null : userInfo.getUser();
		this.setModifyTime(new java.util.Date());
		this.setLastModifier((bairui.international.model.domain.jpa.TB_Admin)user);
	}



}
